<?php
/* @var $this BusinessController */
/* @var $model Business */
?>


<?php
$this->widget('zii.widgets.grid.CGridView', array(
    'id' => 'business-grid',
    'dataProvider' => $model->search(),
    'filter'=>$model,
    'ajaxUrl'=>Yii::app()->createUrl("business/admin"),
        //'showTableOnEmpty'=>FALSE,
    'itemsCssClass' => 'table table-hover',
    'columns' => array(
        //'id',
        array(
            'name' => 'img1',
            'type' => 'image',
            'value' => '"/uploads/$data->img1"',
            'htmlOptions'=>array('class'=>'imgresult img-polaroid')
           // 'class'=>'imgGridview',
        ),
        array(
                'name'=>'title',
                'value'=>'Yii::t("content","$data->title",array(),"db_i18n")'
            ),
		array(
                'name'=>'descripton',
                'value'=>'Yii::t("content","$data->descripton",array(),"db_i18n")'
            ),
        'square_meters',
        'country',
        'district',
        array(
                'name' => 'activ',
                'type' => 'raw',
                'value' => '$data->activ=="1" ? CHtml::image("/images/accept.png",Yii::t("content","Ativo")):CHtml::image("/images/cancel.png",Yii::t("content","Desactivado"))',
            ),
        /*
          'local',
          'category_id',
          'activ',
          'user_id',
          'date_add',
          'date_expire',
          'amount',
          'img1',
          'img2',
          'img3',
          'img4',
          'img5',
         */
        array(
                'class' => 'CButtonColumn',
                'template' => '{update}{delete}',
                'buttons' => array(
                    'delete' => array(
                        'url' => 'Yii::app()->createUrl("business/delete", array("id"=>$data->id))',
                        'imageUrl' => '/images/delete.png'
                    ),
                    'update' => array(
                        'url' => 'Yii::app()->createUrl("business/update", array("id"=>$data->id))',
                        'submit' => 'post',
                        'imageUrl' => '/images/page_white_edit.png',
                        'options' => array('class'=>'updateFila')
                        ),
                ),
            ),
    ),
));
?>
<script>
    
        $('#business-grid').append('<br><a href="<?php echo Yii::app()->createUrl("business/create") ?>" class="btn btn-success"><?php echo Yii::t("content", 'Adicionar') ?></a>');
    

</script>